package org.sheep;

import java.util.ArrayList;

import org.sheep.sprite.LaneManager;

public class SpawnManager {
  private LaneManager lanes;
  private ArrayList<ArrayList<Spawn>> waves = new ArrayList<ArrayList<Spawn>>();
  private int currentWave = -1;
  
  public SpawnManager(LaneManager lm) {
    lanes = lm;
  }
  
  public void addWave(ArrayList<Spawn> s) {
    waves.add(s);
  }
  
  public boolean nextWave() {
    currentWave++;
    if(waves.size() > currentWave) {
      for(Spawn s : waves.get(currentWave))
        s.start();
      
      return true;
    }
    return false;
  }
  
  public void update() {
    if(waves.size() > currentWave)
      for(Spawn s : waves.get(currentWave))
        s.spawn(lanes);
  }
}
